const path = require('path');

module.exports = {
  // webpack 配置
  webpack: {
    // 配置别名
    alias: {
      // 约定：使用 @ 表示 src 文件所在路径
      '@': path.resolve(__dirname, 'src'),
    },
  },
  babel: {
    // plugins: [['@babel/plugin-proposal-decorators', { version: 'legacy' }]],
  },
  eslint: {
    enable: true,
    mode: 'extends',
    configure: {
      extends: ['react-app', 'react-app/jest'],
      parserOptions: {
        parser: '@babel/eslint-parser',
        ecmaFeatures: {
          legacyDecorators: true,
        },
      },
      // plugins: ['react'],
    },
    // configure: (eslintConfig, { env, paths }) => {
    //   /* ... */

    //   console.log('eslintConfig', eslintConfig);
    //   return eslintConfig;
    // },
    pluginOptions: (eslintPluginOptions, { env, paths }) => {
      /* ... */
      console.log('pluginOptions eslintPluginOptions', eslintPluginOptions);
      console.log('pluginOptions env', env);
      console.log('pluginOptions paths', paths);
      return eslintPluginOptions;
    },
  },
};
